import requests
import json

def getdata():
    url="https://weibo.com/ajax/statuses/mymblog?uid=1644917611"
    headers={
    "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36",
    "Referer":"https://weibo.com"
    }   
    cookies={
    "cookie":"你的cookie"
    }
    response=requests.get(url,headers=headers,cookies=cookies)
    if response.status_code!=200:
       return {"Err_code":response.status_code,'msg':'请求失败'}
    content=json.loads(response.text)['data']['list']
    resdata=[]
    for i in content:
        if 'retweeted_status' in i:
           if len(i['retweeted_status']['source'])>0:
               resdata.append({
                   'text':i['text'],
                   'retweet':{
                       'user':i['retweeted_status']['user']['screen_name'],
                       'text':i['retweeted_status']['text'],
                   }
               })
           else:
               resdata.append({
                   'text':i['text'],
                   'retweet':{
                       'text':i['retweeted_status']['text'],
                   }
               })
        else:
            resdata.append({
                'text':i['text']
            })  
    return {'content':resdata}
